Operating system interfaces
import os
os.path.abspath('a/b/c')
# '/Users/darrenkidney/Github/how2/how2-py/a/b/c'
os.path.basename('a/b/c')
# 'c'
os.path.dirname('a/b/c')
# 'a/b'
os.path.expanduser('~')
# '/Users/darrenkidney'
os.path.join('a', 'b', 'c')
# 'a/b/c'
os.path.split('a/b/c')
# ('a/b', 'c')
os.path.getsize('.') # in bytes
# 2432import os
os.path.exists('a/b/c')
# False
os.path.isabs('a/b/c')
# False
os.path.isdir('a/b/c')
# False
os.path.isfile('a/b/c')
# Falseimport os
os.getcwd()
# '/Users/darrenkidney/Github/how2/how2-py'
os.getenv('HOME')
# '/Users/darrenkidney'
os.getenv('BLAH', default='asdf')
# 'asdf'os.mkdir('new_dir')
os.remove('new_file')